<script>
	$('#attempts').live('click', function(){
		url = "/admin/change-attempts?id_transaction="+$(this).next().val()+"&attempt="+$(this).val();

		$.get(url, function(data){
		});
	});
</script>

<div id="list-content">
<div id="transaction-detail">
<fieldset style="margin: 0 auto;">
			<legend style="margin-left: 35px">Dados da Transação</legend>
			<div class="box">
				<div class="cont">
					<div class="detail" >
						<label>Transação: </label>
						<b><?php echo $this->items[0]['id_transaction']?></b><br /><br />
							
						<label>Cliente: </label>
						<b><?php echo $this->items[0]['name']?></b><br /><br />
						
					</div>
					<div class="detail" style="margin-left: 25px;">
						<label>Data da Compra: </label>
						<b><?php echo date("d/m/Y H:i", strtotime($this->items[0]['date']));?></b><br /><br />
						<label>E-mail: </label>
						<b><?php echo $this->items[0]['email']?></b><br /><br/>
					</div>
				</div>
				
				<div class="cont">
					<div class="detail">
						<label>Valor Bruto: </label>
						<b>R$ <?php echo $this->items[0]['grossAmount']?></b>
						
						<label style="margin-left: 30px;">Valor Líquido: </label>
						<b>R$ <?php echo $this->items[0]['netAmount']?></b>
						
						<label style="margin-left: 30px;">Taxa: </label>
						<b>R$ <?php echo $this->items[0]['feeAmount']?></b>
						
						<label style="margin-left: 30px;">Desconto: </label>
						<b>R$ <?php echo $this->items[0]['discountAmount']?></b>
						
						<label style="margin-left: 30px;">Desconto Extra: </label>
						<b>R$ <?php echo $this->items[0]['extraAmount']?></b>
						
						<label style="margin-left: 30px;">Valor do Frete: </label>
						<b>R$ <?php echo $this->items[0]['shippingCost']?></b><br /><br />
					</div>
				</div>
				
				<div class="cont">
					<div class="detail" >
						<label>Endereço de Entrega: </label>
						<b><?php echo utf8_encode($this->items[0]['street']) . ", " . $this->items[0]['number']
						. "  -  " . utf8_encode($this->items[0]['district'])
						. "  -  " . utf8_encode($this->items[0]['city']) . "  -  " .$this->items[0]['state']?></b><br /><br />
					</div>
					
					<div class="detail" style="margin-left: 25px;">
						<label>CEP: </label>
						<b><?php echo $this->items[0]['zipcode'];?></b><br />
					</div>
					
					<div class="detail">
						<label>Complemento: </label>
						<b><?php echo $this->items[0]['complement'];?></b><br /><br />
					</div>
				</div>
				
				<?php if(utf8_encode(strtolower($this->items[0]['city'])) == 'araraquara'):?>
				<div class="count">
					<div class="detail">
						<label>Horário para entrega: </label>
						<b><?php echo $this->items[0]['delivery_hour'];?></b>
						
						<label style="margin-left: 25px;">Entregar para: </label>
						<b><?php echo $this->items[0]['receiver'];?></b>
						
						<label style="margin-left: 25px;">Tentativas de entrega: </label>
						<select style="width: 100px;" id="attempts" name="attempts">
							<option selected="selected" value="0">0</option>
							<option <?php if($this->items[0]['attempts'] == 1):?>selected="selected"<?php endif;?> value="1">1</option>
							<option <?php if($this->items[0]['attempts'] == 2):?>selected="selected"<?php endif;?> value="2">2</option>
							<option <?php if($this->items[0]['attempts'] == 3):?>selected="selected"<?php endif;?> value="3">3</option>
						</select>
						<input type="hidden" value="<?php echo $this->items[0]['id_transaction']?>">
					</div>
				</div>
				<?php endif;?>
				
			</div>
			
			<div class="box">
						<b>Produtos comprados: </b>
			<table>
				<thead>
					<th width="100">
					</th>
					<th width="300" align="left">
						Descrição
					</th>
					<th width="150" align="left">
						Valor Unitário
					</th>
					<th width="150" align="left">
						Quantidade
					</th>
					<th width="100" align="left">
						Valor Total
					</th>
				</thead>
				
				<tbody>
				<?php foreach ($this->items as $cart):?>
					<tr height="50">
					
						<td>
						<img width="90" height="90" alt="" src="<?php echo $cart['image']?>">
						</td>
						<td width="300" align="left">
							<?php echo utf8_encode($cart["title"]) .' - '.$cart['pr_name']?>
						</td>
						
						<td width="150" align="left">
							<?php echo 'R$' . number_format($cart['price'], 2, ',', '.')?>
						</td>
						
						<td width="150" align="left">
							<?php echo $cart['qtd']?>
						</td>
						
						<td width="100" align="left">
							<?php echo 'R$' . number_format($cart['price']*$cart['qtd'], 2, ',', '.')?>
						</td>
					</tr>
				<?php endforeach;?>
					 
				</tbody>
			</table>
	</div>
		</fieldset>
	<div class="formLeft" style=" float: right; margin-top: -70px;">
		<div style="width: 130px; height: 20px;">
			<b style="color: #000; line-height: 18px; font-size: 16px">Total da Compra</b>
		</div>
		<div style="widows: 130px; height: 30px; padding-top: 10px; margin-top: 5px;">
			<b style="color: black; font-size: 30px; line-height: 15px; padding-left: 20px; font-family: amerika;">
				<?php echo 'R$'.number_format($this->items[0]['grossAmount'], 2, ',', '.')?>
			</b>
		</div>
	</div>

</div>
</div>